package com.sctvcloud.dongqu.ui.adapter.holder;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextSwitcher;
import android.widget.TextView;
import android.widget.ViewSwitcher;

import com.ruihang.generalibrary.ui.util.IAndroidLittleLife;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.ruihang.generalibrary.utils.ListUtils;
import com.sctvcloud.dongqu.R;
import com.sctvcloud.dongqu.application.Constances;
import com.sctvcloud.dongqu.beans.HomeListItem;
import com.sctvcloud.dongqu.beans.NewsItem;

import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import butterknife.BindView;
import butterknife.ButterKnife;

import static com.sctvcloud.dongqu.application.Constances.INFORMATION_TYPE_FLASH;

public class HomeExpressHolder extends BaseAbsHolder<HomeListItem> implements IAndroidLittleLife, View.OnClickListener {
    @BindView(R.id.home_active_title)
    protected CustomFontTextView title;
    private List<NewsItem> data;
    private Handler handler;
    private int currentPos;
    private boolean hasInManager;
    private OnExpressClickListener listener;
    private boolean isFirst = true;
    private NewsItem item;
    public HomeExpressHolder(final Context context, View itemView, OnExpressClickListener listener) {
        super(context, itemView);
        this.listener = listener;
        itemView.setOnClickListener(this);

    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(HomeListItem newsItem) {
        if (null != newsItem && ListUtils.isListValued(newsItem.getNewsItemList())) {
            data = newsItem.getNewsItemList();
            item = data.get(0);
            title.setText(data.get(0).getNewsTitle());
        }

    }


    @Override
    public int onIResume() {
        return 0;
    }

    @Override
    public int onIPause() {
        return 0;
    }

    @Override
    public int onIDestory() {
        return 0;
    }

    @Override
    public void setHasInManager(boolean inManager) {
        this.hasInManager = inManager;
    }

    @Override
    public boolean hasInManager() {
        return hasInManager;
    }

    @Override
    public void setLifeMode(int mode) {

    }

    @Override
    public void onClick(View view) {
        if (listener != null) {
            listener.OnExpressClick(item);
        }
    }

    public interface OnExpressClickListener {
        void OnExpressClick(NewsItem item);
    }
}

